package com.itheima.dao;

import com.itheima.domain.Book;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface BookDao {
    @Select("select * from tbl_book")
    List<Book> findAll();

    @Select("select *from tbl_book where id=#{id}")
    Book findById(Integer id);

    @Insert("insert into tbl_book values (#{id},#{type},#{name},#{description})")
    int insert(Book book);

    @Delete("delete from tbl_book where id=#{id}")
    int delete(Integer id);

    @Update("update tbl_book set TYPE=#{type},NAME=#{name},description=#{description} where id=#{id}")
    int update(Book book);
}
